function implementation.